import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/index',
  },
    {path:'/index',component: ()=>import('../views/IndexView')},
    {path:'/home',component: ()=>import('../views/HomeView')},
    {path:'/login',component: ()=>import('../views/LoginView')},
    {path:'/person',component: ()=>import('../views/PersonView')},
    {path:'/reg',component: ()=>import('../views/RegView')},
  {
    path: '/devices',
    children: [
      {path:'deviceDetail',component: ()=>import('../views/devices/DeviceDetailView')},
      {path:'device',component: ()=>import('../views/devices/DeviceListView')},
      {path:'scheme',component: ()=>import('../views/devices/SchemeView')},
    ]
  },
  {
    path: '/faults',
    children: [
      {path:'faultsList',component: ()=>import('../views/faults/FaultsListView')},
    ]
  },
  {
    path: '/networks',
    children: [
      {path:'netWork',component: ()=>import('../views/networks/NetWorkView')},
    ]
  },
  {
    path: '/orders',
    children: [
      {path:'ordersList',component: ()=>import('../views/orders/OrderListView')},
    ]
  },
  {
    path: '/permission',
    children: [
      {path:'role',component: ()=>import('../views/permission/RoleView')},
    ]
  },
  {
    path: '/repair',
    children: [
      {path:'repairList',component: ()=>import('../views/repair/RepairListView')},
    ]
  },
  {
    path: '/scheme',
    children: [
      {path:'energyBasedRate',component: ()=>import('../views/scheme/EnergyBasedRateView')},
      {path:'money',component: ()=>import('../views/scheme/MoneyView')},
      {path:'timeBasedRate',component: ()=>import('../views/scheme/TimeBasedRateView')},
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
